home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Documentation / CFDOCS / cfmlsyntaxcheck / syntaxcheck.cfm (.txt) < prev   
Encoding:
ColdFusion Encrypted Template  |  2001-06-13  |  2.2 KB  |  82 lines

  1. <!---
  2.     
  3.     Template:            SyntaxCheck.cfm
  4.     Author:                Simeon Simeonov
  5.     
  6.     Source Control:        $Header: /ColdFusion/Docs/syntaxcheck.cfm 3     8/19/98 3:51p Ereiber $
  7.     
  8.     CF_SyntaxCheck:
  9.     
  10.     Checks a directory tree of cold fusion templates for syntax errors
  11.     and returns a query with two columns: (TemplatePath, ErrorMessage).
  12.     Every row of the query gives the full path to a template that
  13.     failed the syntax check and the error message.
  14.     
  15.     Usage:
  16.     
  17.     <CF_SyntaxCheck Directory=... Filter=... Recurse=... ResultQuery=...>
  18.     
  19.     Attributes:
  20.     
  21.     Directory (required, string)
  22.     The root of the directory tree for syntax checking, for example, "c:\wwwroot"
  23.  
  24.     Filter (optional, string, default: *.cfm)
  25.     Filter (search specifdication) to use for file checking. You may want
  26.     to use *.?fm (to match .cfm and old style .dbm files).
  27.     
  28.     Recurse (optional, boolean, default: true)
  29.     Determines whether a recursive directory search is performed.
  30.     
  31.     ResultQuery (required, variable name)
  32.     The name of the query that the tag creates in the caller scope.
  33.     
  34. --->
  35.  
  36. <!---
  37.     Validate attribute set
  38. --->
  39.  
  40. <cfparam name="attributes.directory">
  41. <cfparam name="attributes.filter" default="*.cfm">
  42. <cfparam name="attributes.recurse" default=true>
  43. <cfparam name="attributes.resultquery">
  44.  
  45. <!---
  46.     Get a list of the files
  47. --->
  48.  
  49. <CF_DirectoryList
  50.     directory=#attributes.directory#
  51.     filter=#attributes.filter#
  52.     recurse=#attributes.recurse#
  53.     resultQuery=fileList>
  54.     
  55. <!---
  56.     Iterate over the list of files and perform a syntax check
  57. --->
  58.  
  59. <cfset resultQuery = QueryNew("TemplatePath, ErrorMessage")>
  60. <cfloop query=fileList>
  61.     <cfif type is not "Dir">
  62.         <cfinternaldebug action=pcode templatePath=#path# outVar=msg>
  63.         <cfif msg is not "">
  64.             <!--- syntax check error --->
  65.             <cfset temp = queryAddRow(resultQuery)>
  66.             <cfset temp = querySetCell(resultQuery, "TemplatePath", path)>
  67.             <cfset temp = querySetCell(resultQuery, "ErrorMessage", msg)>
  68.         </cfif>
  69.     </cfif>
  70. </cfloop>
  71.  
  72. <!---
  73.     Set resulting query
  74. --->
  75.  
  76. <cfset "Caller.#attributes.resultQuery#" = resultQuery>
  77.  
  78.  
  79.  
  80.  
  81.  
  82.